<include file="../header" />
</head>
<body class="J_scroll_fixed">
<script type="text/javascript">
    $(function() {

        if("{$hisRx.patient_name}" != ""){
            if(confirm("是否加载 {$hisRx.patient_name}_{$hisRx.side}_{$hisRx.admin_name}({$hisRx.update_time}) 更新的处方记录？")){
                var id = "{$workorder.workorder_id}";
                var hisId = "{$hisRx.rx_common_id}";

                var url ="/admin/workorder/rxFid="+id+"&hisId="+hisId;
                window.location.href = url;
            }
        }
        $("select[name='patient']").change(function () {
            var id = "{$workorder.workorder_id}";
            var hisId = $("select[name='patient']").val();
            if(!confirm("是否加载 "+$("select[name='patient']").find("option:selected").text()+"的处方记录？")){
                return false;
            }else {
                var url = "/admin/workorder/rx?id=" + id + "&hisId=" + hisId;
                window.location.href = url;
            }
        });
        if($("select[name='rt0']").val() == "其他") {
            $("input[name='rt1']").show();
        };


        $("select[name='rt0']").change(function () {
            if($("select[name='rt0']").val() == "其他") {
                $("input[name='rt1']").show();
            } else {
                $("input[name='rt1']").val("");
                $("input[name='rt1']").hide();
            }

        });

        $("input[name=completed]").click(function() {
            if($("input[name=completed]").is(':checked')) {
                $("button.btn_submit").text("完成");
            }else{
                $("button.btn_submit").text("更新");
            }
        });

        $("button.btn_submit").click(function() {
            if($("input[name=completed]").is(':checked')) {
                if (confirm("勾选'完成'后提交处方单将无法再次修改，是否继续提交")) {
                    $("button.btn_submit").hide();
                } else {
                    return false;
                }
            }else{
                $("button.btn_submit").hide();
            }
        })

//        $("button.btn_submit").click(function() {
//
//            if($("input[name=completed]").is(':checked')) {
//                if (!confirm("勾选'完成'后提交处方单将无法再次修改，是否继续提交？")) {
//                    return false;
//                }else{
////                    $("form").submit();
//                }
//            }
//        });
    })
</script>
<div class="wrap jj">
    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('Workorder/rx_fo_post')}" onkeydown="if(event.keyCode==13)return false;" >
            <input type="hidden" name="workorderId" value="{$workorderId}" />
            <input type="hidden" name="rxId" value="{$rxId}" />
            <fieldset>
                <div class="control-group">
                    <label class="control-label"></label>
                    <div class="controls" style="font-weight: bold; font-size: larger">
                        {$workorder.patient_name}({$workorder.side})
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">历史病例:</label>
                    <div class="controls">
                        <select name="patient" style="width: 600px">
                            {:getRxCommonSelectOptionHtml($workorder['rx_common_id'], $workorder['patient_name'], $workorder['workorder_type'])}
                        </select>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">类别:</label>
                    <div class="controls">
                        <select name="rt0" style="width: 100px;">
                            {:getFormDictSelectOption($rx['rt0'],'type','rxFo',1)}
                        </select>
                        &nbsp;&nbsp;&nbsp;
                        <input type="text" class="input" style="width: 300px; display: none" name="rt1" value="{$rx.rt1}" placeholder="填写其他类别名称">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">相关说明:</label>
                    <div class="controls">
                        <input type="text" class="input" style="width: 600px" name="rt2" value="{$rx.rt2}">
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">对线要求：</label>
                    <div class="controls">
                        <textarea style="height:80px; width: 600px;" name="long0">{$rx.long0}</textarea>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">材料：</label>
                    <div class="controls">
                        <textarea style="height:80px; width: 600px;" name="rt3">{$rx.rt3}</textarea>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">阳型调整：</label>
                    <div class="controls">
                        <textarea style="height:80px; width: 600px;" name="long1">{$rx.long1}</textarea>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">加垫：</label>
                    <div class="controls">
                        位置：
                        <input type="text" class="input"  style="width: 550px" name="rt4" value="{$rx.rt4}" placeholder="">
                    </div>
                    <div class="controls">
                        说明：
                        <input type="text" class="input"  style="width: 550px" name="rt5" value="{$rx.rt5}" placeholder="">
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">鞋底：</label>
                    <div class="controls">
                        <input type="text" class="input"  style="width: 600px" name="rt6" value="{$rx.rt6}" placeholder="">
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">尼龙搭扣或绑带：</label>
                    <div class="controls">
                        位置：
                        <input type="text" class="input"  style="width: 550px" name="rt7" value="{$rx.rt7}" placeholder="">
                    </div>
                    <div class="controls">
                        说明：
                        <input type="text" class="input"  style="width: 550px" name="rt8" value="{$rx.rt8}" placeholder="">
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">切割线：</label>
                    <div class="controls">
                        <textarea style="height:80px; width: 600px;" name="long2">{$rx.long2}</textarea>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" style="font-weight: bold">备注：</label>
                    <div class="controls">
                        <textarea style="height:80px; width: 600px;" name="note">{$rx.note}</textarea>
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label">适配方式:</label>
                    <div class="controls">
                        <select name="adapt" style="width: 150px">
                            {:getFormDictSelectOptionHtml($rx['adapt'],'adapt','all',1)}
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">矫形器价格：</label>
                    <div class="controls">
                        <input type="text" class="input" style="width: 100px" name="price" value="{$rx.price}">
                        元
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">其他矫形器：</label>
                    <div class="controls">
                        <input type="text" class="input" style="width: 480px" name="other_type" value="{$rx.other_type}">
                        价格：
                        <input type="text" class="input" style="width: 100px" name="other_price" value="{$rx.other_price}">
                        元
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">预计交付日期：</label>
                    <div class="controls">
                        <input type="text" class="input J_date" style="width: 100px" name="delivery_date" value="{$rx.delivery_date}">
                    </div>
                </div>
                <hr class="half-rule">
                <div class="control-group">
                    <div class="controls">
                        <label class="checkbox inline" style="font-weight: bold">
                            <input type="checkbox"  name="completed">完成（勾选后提交处方将无法再次修改）
                        </label>
                    </div>
                </div>

            </fieldset>
            <div class="form-actions">
                <input type="hidden" name="rxId" value="{$rxId}" />
                <input type="hidden" name="id" value="{$id}" />
                <button type="submit" class="btn btn-primary btn_submit ">更新</button>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>